<script type="text/javascript">

    function serilizeURL(url) {
        var rs = url.split("?")[1];
        var arr = rs.split("&");
        var json = {};
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].indexOf("=") != -1) {
                json[arr[i].split("=")[0]] = arr[i].split("=")[1];
            }
            else {
                json[arr[i]] = "undefined";
            }
        }

        return json;
    }

    var url = location.href;
    var pid = serilizeURL(url).pid;  //一级菜单栏id
    var urls = '';
    var secondMenuId = serilizeURL(url).secondMenuId; //二级菜单栏id
    var cid;

    function getAllColumnList() {
        var FirstLevelColumnList;
        var FirstLevelColumnListLength;
        var url = location.href;
        if (url.split("?")[1] && url.split("?")[1].split("&")) {
            var pid = serilizeURL(url).pid;
        }

        localStorage.getItem('getAllColumnList');
        FirstLevelColumnList = JSON.parse(localStorage.getItem('getAllColumnList'));

        FirstLevelColumnListLength = FirstLevelColumnList.length;

        for (var i = 0; i < FirstLevelColumnListLength; i++) {
            var list_active = '<li id=' + FirstLevelColumnList[i].id + '><a href=http://192.168.100.181:8080/huoge-edu/' + FirstLevelColumnList[i].typeUrl + '?pid=' + FirstLevelColumnList[i].id + '&secondMenuId=' + FirstLevelColumnList[i].secondMenuId + '>' + FirstLevelColumnList[i].name + '</li>';
            var mobile_active = `<li data-id=${FirstLevelColumnList[i].id} id=${FirstLevelColumnList[i].id }><a id=mnav${FirstLevelColumnList[i].id} href=http://192.168.100.181:8080/huoge-edu/${FirstLevelColumnList[i].typeUrl}?pid=${FirstLevelColumnList[i].id}&secondMenuId=${FirstLevelColumnList[i].secondMenuId}><span>${FirstLevelColumnList[i].name}</span></li>`;

            $('#j_dy_active').append($(list_active).hide().fadeIn(0));
            $('#mobile-nav').append($(mobile_active).hide().fadeIn(0));

            if (pid && pid === FirstLevelColumnList[i].id) {
                $('#' + FirstLevelColumnList[i].id).addClass('active');
                $('#mnav' + FirstLevelColumnList[i].id).addClass('active');
            } else if (undefined == pid) {
                $('#' + FirstLevelColumnList[0].id).addClass('active');
                $('#mnav' + FirstLevelColumnList[0].id).addClass('active');
            }
        }
    }


    function getSecondListByPid(pid) {

        $.ajax({
            url: "http://192.168.100.181:8080/api/columnInfo/getColumnListByPid/" + pid,
            success: function (data) {
                getColumnListByPid = data.data;
                getColumnListByPidLength = getColumnListByPid.length;


                for (var i = 0; i < getColumnListByPidLength; i++) {

                    cid = getColumnListByPid[0].id;



                    urls = urls + '<li>' + getColumnListByPid[i].name + '</li>';

                    $('.container .secondMenu-txt').html(getColumnListByPid[i]['columnInfoByParentId'].name);
                    $('.pull-right.hidden-xs .list').append(`<li id=${getColumnListByPid[i].id} data-english="${getColumnListByPid[i].subtitle}" data-typeUrl=${getColumnListByPid[i].typeUrl} data-type=${getColumnListByPid[i].type}><a href="javascript:;">${getColumnListByPid[i].name}</a></li>`);
                    $('.pull-right.mobile-sub-nav.visible-xs .list').append(`<li id=${getColumnListByPid[i].id} data-english="${getColumnListByPid[i].subtitle}" data-typeUrl=${getColumnListByPid[i].typeUrl} data-type=${getColumnListByPid[i].type}><a href="javascript:;" id=msnav${getColumnListByPid[i].id} >${getColumnListByPid[i].name }</a></li>`);
                    $('.pull-left.hidden-xs .secondMenu-txt').html('<a href="javascript:;">' + getColumnListByPid[i]['columnInfoByParentId'].name + '</a>');
                    $('.dx-abs-nav .dx-txt-nav span').html(getColumnListByPid[i]['columnInfoByParentId'].name);
                    addActiveTabs(getColumnListByPid[i].id);
                }
                var text = $($('.active')[2])[0].innerText;
                $('.english-title').html($($('.active')[2]).data('english'));
                $('.article-title').html(text);
                document.title = $('#' + secondMenuId + '.active a')[0].innerText;
                if ($('#' + secondMenuId + '.active a')[0].innerText.indexOf('旗下品牌') >= 0) {
                    $('.project-show').hide();
                } else {
                    $('.project-show').show();
                }


                $('.pull-right.hidden-xs .list li').on('mouseover', function (event) {
                    $(this).addClass('active_hover');
                })

                $('.pull-right .list li').on('mouseout', function (event) {
                    $('.pull-right.hidden-xs .list li').removeClass('active_hover');
                })

                $('.pull-right .list li').on('click', function (event) {
                    $('.pull-right.hidden-xs .list li').removeClass('active');
                    $('.pull-right.mobile-sub-nav.visible-xs li a').removeClass('active');

                    $(event.target).data('typeurl')?typeUrl = $(event.target).data('typeurl'):typeUrl = $(event.target).parent('li').data('typeurl');

                    $('.dx-content').empty();
                    $('.j_project_slider').empty();



                    location.href = "http://192.168.100.181:8080/huoge-edu/" + typeUrl + "?pid=" + pid + "&secondMenuId=" + this.id;

                    setTimeout(function () {
                        var nw = screen.width;
                        if (nw <= 768) {
                            var bkSlider = $(".j_project_slider").bxSlider({
                                auto: true,
                                pager: false,
                                minSlides: 1,
                                maxSlides: 1,
                                moveSlides: 1,
                                slideWidth: 383.33,
                                onSlideAfter: function () {
                                    bkSlider.startAuto();
                                }
                            });
                        } else {
                            $(".j_project_slider").bxSlider({
                                auto: true,
                                pager: false,
                                minSlides: 1,
                                maxSlides: 3,
                                moveSlides: 1,
                                slideWidth: 383.33
                            });
                        }
                        //判断滚动条
                        var nav = $("#j_nav"); //得到导航对象
                        var win = $(window); //得到窗口对象
                        var sc = $(document);//得到document文档对象

                        win.scroll(function () {
                            if (sc.scrollTop() >= 112) {
                                nav.addClass("fixednav");
                            } else {
                                nav.removeClass("fixednav");
                            }
                        });

                        if ($(".slider").length == 0) {
                            $(".bx-controls").css("display", "none")
                        }
                    }, 2000)


                })
            }
        })
    }

    function addActiveTabs(loopPid) {
        if (secondMenuId == undefined && getColumnListByPid[0].id != undefined) {
            secondMenuId = getColumnListByPid[0].id;
            $('#' + getColumnListByPid[0].id).addClass('active');
            $('#msnav' + getColumnListByPid[0].id).addClass('active');
        }
        if (secondMenuId && secondMenuId === loopPid) {
            $('#' + loopPid).addClass('active');
            $('#msnav' + loopPid).addClass('active');
        }
    }

    function getFragment(param, secondMenuId) {
        var getFragmentLists;
        var getFragmentLength;
        $.ajax({
            url: "http://192.168.100.181:8080/api/fragment/" + secondMenuId + '/' + param,
            success: function (data) {
                getFragmentLists = data.data;
                getFragmentLength = getFragmentLists.length;
                $('.dx-content').append(getFragmentLists);
                console.log(getFragmentLists);
            }
        });
    }


    $(document).ready(function () {

        getAllColumnList();

        getSecondListByPid(pid);
    })


</script>


<script>
    //轮
    setTimeout(function () {
        var nw = screen.width;
        if (nw <= 768) {
            var bkSlider = $(".j_project_slider").bxSlider({
                auto: true,
                pager: false,
                minSlides: 1,
                maxSlides: 1,
                moveSlides: 1,
                slideWidth: 383.33,
                onSlideAfter: function () {
                    bkSlider.startAuto();
                }
            });
        } else {
            $(".j_project_slider").bxSlider({
                auto: true,
                pager: false,
                minSlides: 1,
                maxSlides: 3,
                moveSlides: 1,
                slideWidth: 383.33
            });
        }
        //判断滚动条
        var nav = $("#j_nav"); //得到导航对象
        var win = $(window); //得到窗口对象
        var sc = $(document);//得到document文档对象

        win.scroll(function () {
            if (sc.scrollTop() >= 112) {
                nav.addClass("fixednav");
            } else {
                nav.removeClass("fixednav");
            }
        });

        if ($(".slider").length == 0) {
            $(".bx-controls").css("display", "none")
        }
    }, 1000)

</script>
<header class="header">
    <div class="dy-header-nav clearfix do-top-bar">
        <div class="dy-logo do-logo hidden-xs">
            <a href="http://192.168.100.181:8080/huoge-edu/index.html">
                <img src="http://192.168.100.181:8080/huoge-edu/src/img/logo.png" alt=""></a>
        </div>
        <div class="dy-nav main-nav-w clearfix hidden-xs">
            <ul class="clearfix main-nav" id="j_dy_active">
            </ul>
        </div>
        <div class="dy-language-chosse do-lang hidden-xs">
            <a href="javascript:;"><i class="iconfont icon-en"></i></a>
            <a class="hidden-xs" href=""><i class="iconfont icon-zhanghu"></i></a>
        </div>

        <!--移动端导航 开始-->
        <div class="visible-xs px-mobile">
            <div class="dy-logo do-logo mobile-logo"><a href="http://192.168.100.181:8080/huoge-edu/index.html"><img
                    src="http://192.168.100.181:8080/huoge-edu/src/img/logo.png" alt=""></a>
            </div>
            <div class="dy-language-chosse do-lang">
                <a href="javascript:;"><i class="iconfont icon-en"></i></a>
            </div>
            <div class="dy-nav main-nav-w clearfix">
                <button class="bread" type="button" id="dropdownMenu2">
                    <i class="icon-bar"></i>
                    <i class="icon-bar"></i>
                    <i class="icon-bar"></i>
                </button>
                <ul class="clearfix main-nav" id="mobile-nav">
                </ul>
            </div>

        </div>
        <!--移动端导航 结束-->

    </div>
</header>
<div class="dx-nav dx-project">

    <div class="dx-abs-nav">
        <div class="nav" id="j_nav">
            <div class="container clearfix">
                <div class="pull-left hidden-xs">
                    <ol class="breadcrumb">
                        <li><a href="../../index.html">首页</a></li>
                        <li class="secondMenu-txt"></li>
                    </ol>
                </div>
                <div class="pull-right hidden-xs">
                    <div class="mobile-sub-tip"></div>
                    <ul class="list clearfix" style="width: 100%">
                    </ul>
                </div>

                <!--移动二级菜单-->
                <div class="title mobile-title  visible-xs">
                    <div class="container">
                        <!--<p class="secondMenu-txt"></p>-->
                    </div>
                </div>
                <div class="pull-right mobile-sub-nav visible-xs">
                    <ul class="list clearfix" style="width: 100%">
                    </ul>
                </div>

            </div>

        </div>
        <!--<div class="hidden-xs dx-txt-nav">-->
        <!--<span></span>-->
        <!--<p>__</p>-->
        <!--</div>-->
    </div>
</div>

